home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 86
/
(Vol 86) My Disc.iso
/
Games
/
restaurante_1072.swf
/
scripts
/
__Packages
/
Customer.as
< prev
next >
Wrap
Text File
|
2009-04-16
|
14KB
|
386 lines
if(true)
{
if(true)
{
§§push(false);
}
if(!§§pop())
{
if(true)
{
if(true)
{
§§push(false);
}
if(!§§pop())
{
if(!_global.Customer)
{
_global.Customer extends MissionItem;
var _loc2_ = _global.Customer = function($mc, $type)
{
super($mc);
this._type = $type;
this.__set__status(Customer.STAND);
this.beginLoseHeart();
var _loc3_ = Math.random();
if(_loc3_ >= 0.5)
{
this.happy();
}
else
{
this.sad();
}
}.prototype;
_loc2_.beginLoseHeart = function()
{
this.lostHeartInterval = setInterval(this,"wait",1000);
};
_loc2_.happy = function()
{
this.maxPatience = 30000;
};
_loc2_.sad = function()
{
this.__get__mood().gotoAndStop("sad");
this.maxPatience = 15000;
};
_loc2_.stopLoseHeart = function()
{
clearInterval(this.lostHeartInterval);
};
_loc2_.__get__isDragging = function()
{
return this._isDragging;
};
_loc2_.__get__mood = function()
{
return MovieClip(this.__get__mc().mood);
};
_loc2_.__set__status = function(value)
{
super.__set__status(value);
this.refreshDirection();
this.refreshHearts();
return this.__get__status();
};
_loc2_.__get__directionNow = function()
{
return this.direction;
};
_loc2_.__get__table = function()
{
return this._table;
};
_loc2_.__get__CLASS = function()
{
return Customer;
};
_loc2_.__set__mc = function(value)
{
this._mc = value;
this.__get__mc().gotoAndStop(this.__get__status());
this.refreshDirection();
this.refreshHearts();
return this.__get__mc();
};
_loc2_.__get__type = function()
{
return this._type;
};
_loc2_.__get__numHearts = function()
{
return this._numHearts;
};
_loc2_.setDirection = function(d)
{
this.direction = d;
this.refreshDirection();
};
_loc2_.terminate = function()
{
this.__get__mc().removeMovieClip();
this.stopLoseHeart();
false;
};
_loc2_.changeHearts = function(h)
{
if(h > 0)
{
this.plusHearts(h);
}
else
{
if(h >= 0)
{
return this.__get__numHearts();
}
this.minusHearts(h * -1);
}
this.refreshHearts();
return this.__get__numHearts();
};
_loc2_.leave = function(fromTable)
{
if(this.__get__table() && !fromTable && this.__get__status() == Customer.SIT)
{
this.__get__table().customersLeave(this);
}
if(fromTable)
{
this._numHearts = 1;
this.refreshHearts();
this.__get__mc()[MissionData.DATA[Mission.getMission().__get__id()].customer.status].gotoAndStop("angry");
}
if(this.__get__status() == Customer.STAND)
{
Mission.getMission().__get__door().customerLeave(this);
}
if(!this.__get__table())
{
this.terminate();
}
};
_loc2_.refreshDirection = function()
{
this.__get__mc()[this.__get__status()].gotoAndStop(this.direction);
};
_loc2_.plusHearts = function(h)
{
this._numHearts += h;
this._numHearts = this._numHearts <= Customer.MAXNUMHEARTS ? this._numHearts : Customer.MAXNUMHEARTS;
return this.__get__numHearts();
};
_loc2_.minusHearts = function(h)
{
if(this._numHearts > 0)
{
this._numHearts -= h;
}
if(this._numHearts <= 0)
{
this.leave();
this.__get__mc()[MissionData.DATA[Mission.getMission().__get__id()].customer.status].gotoAndStop("angry");
return 0;
}
return this.__get__numHearts();
};
_loc2_.refreshHearts = function()
{
var obj = this;
var _loc2_ = MissionData.DATA[Mission.getMission().__get__id()];
this.__get__mc()[_loc2_.customer.status].gotoAndStop(this.__get__numHearts());
if(!this.__get__mood()._visible)
{
this.__get__mood()._visible = true;
var interval = setInterval(function()
{
obj.__get__mood()._visible = false;
clearInterval(interval);
}
,2000);
}
if(this.__get__numHearts() >= 5)
{
this.__get__mood().gotoAndStop("happy");
}
else if(this.__get__numHearts() >= 3)
{
this.__get__mood().gotoAndStop("general");
}
else
{
this.__get__mood().gotoAndStop("sad");
}
return this.__get__numHearts();
};
_loc2_.wait = function()
{
this.patience -= 1000;
if(this.patience <= 0)
{
this.patience = this.maxPatience;
this.changeHearts(-1);
}
};
_loc2_.standHandle = function()
{
var obj = this;
this.__get__mc().onPress = function()
{
obj.__get__mc().startDrag();
Mission.getMission().draggingMc = this;
this.swapDepths(Mission.getMission().__get__mc().getNextHighestDepth());
obj._isDragging = true;
this.onMouseMove = function()
{
obj.onMouseMoveWhenStand();
updateAfterEvent();
};
};
this.__get__mc().onRelease = this.__get__mc().onReleaseOutside = function()
{
obj.__get__mc().stopDrag();
Mission.getMission().draggingMc = null;
obj._isDragging = false;
obj.__get__mc().onMouseMove = null;
obj.mcDropped();
Mission.getMission().__get__door().refresh();
};
};
_loc2_.onMouseMoveWhenStand = function()
{
if(this.__get__table() == null)
{
this._table = this.getTouchTable();
}
else if(McTools.isMouseInMc(this.__get__table().__get__mc()))
{
this.__get__table().onRollOver();
}
else
{
this.__get__table().onRollOut();
this._table = null;
}
};
_loc2_.sitHandle = function()
{
this.__get__mc().onPress = null;
this.__get__mc().onMouseMove = null;
this.__get__mc().onRelease = null;
};
_loc2_.mcDropped = function()
{
this._table = this.getTouchTable();
if(this.__get__table() != null)
{
this.__get__table().onRollOut();
this.__get__table().addCustomer(this);
}
else
{
Mission.getMission().__get__door().refresh();
}
};
_loc2_.getTouchTable = function()
{
var _loc2_ = Mission.getMission().__get__tables();
var _loc1_ = 0;
while(_loc1_ < _loc2_.length)
{
if(McTools.isMouseInMc(_loc2_[_loc1_].mc) && Table(_loc2_[_loc1_]).__get__isNotFull() && Table(_loc2_[_loc1_]).__get__numCustomers() < Table(_loc2_[_loc1_]).__get__maxNumCustomers())
{
return _loc2_[_loc1_];
}
_loc1_ = _loc1_ + 1;
}
return null;
};
_loc2_.toString = function()
{
return CustomerType.__get__TYPES()[this.__get__type()];
};
_global.Customer = function($mc, $type)
{
super($mc);
this._type = $type;
this.__set__status(Customer.STAND);
this.beginLoseHeart();
var _loc3_ = Math.random();
if(_loc3_ >= 0.5)
{
this.happy();
}
else
{
this.sad();
}
}.STAND = "stand";
_global.Customer = function($mc, $type)
{
super($mc);
this._type = $type;
this.__set__status(Customer.STAND);
this.beginLoseHeart();
var _loc3_ = Math.random();
if(_loc3_ >= 0.5)
{
this.happy();
}
else
{
this.sad();
}
}.SIT = "sit";
_global.Customer = function($mc, $type)
{
super($mc);
this._type = $type;
this.__set__status(Customer.STAND);
this.beginLoseHeart();
var _loc3_ = Math.random();
if(_loc3_ >= 0.5)
{
this.happy();
}
else
{
this.sad();
}
}.MAXNUMHEARTS = 6;
_loc2_._numHearts = 3;
_loc2_.direction = 3;
_loc2_._type = 0;
_loc2_._table = null;
_loc2_.maxPatience = 30000;
_loc2_.patience = 30000;
_loc2_._isDragging = false;
§§push(_loc2_.addProperty("CLASS",_loc2_.__get__CLASS,function()
{
}
));
§§push(_loc2_.addProperty("directionNow",_loc2_.__get__directionNow,function()
{
}
));
§§push(_loc2_.addProperty("isDragging",_loc2_.__get__isDragging,function()
{
}
));
§§push(_loc2_.addProperty("mc",function()
{
}
,_loc2_.__set__mc));
§§push(_loc2_.addProperty("mood",_loc2_.__get__mood,function()
{
}
));
§§push(_loc2_.addProperty("numHearts",_loc2_.__get__numHearts,function()
{
}
));
§§push(_loc2_.addProperty("status",function()
{
}
,_loc2_.__set__status));
§§push(_loc2_.addProperty("table",_loc2_.__get__table,function()
{
}
));
§§push(_loc2_.addProperty("type",_loc2_.__get__type,function()
{
}
));
§§push(ASSetPropFlags(_global.Customer.prototype,null,1));
}
§§pop();
}
}
§§goto(addr882);
}
§§push([]);
}
addr882: